package org.xiaog.dao;

import org.xiaog.entity.Login;
import org.xiaog.entity.User;
import org.xiaog.fastdao.FastDao;
import org.xiaog.fastdao.annotation.Delete;
import org.xiaog.fastdao.annotation.Insert;
import org.xiaog.fastdao.annotation.Select;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface UserDao extends FastDao<User,Integer> {

    @Select("select * from user where username = ?")
    Set<User> setUserByName(String name);

    @Select("select * from user where username = ?")
    List<User> listUserByName(String name);

    @Select("select * from user where username = ?")
    User[] arrayUserByName(String name);

    @Select("select * from user where username = ? limit 1")
    User getUserByName(String name);

    @Select("select * from user where username = ? limit 1")
    Map<String,Object> getMapByName(String name);

    @Select("select id from user where username = ?")
    List<Integer> listIdByName(String name);

    @Select("select id,password from user where username = ?")
    List<User> listIdPasswordByName(String name);

    @Select("select id,password from user where username = ?")
    User idPasswordByName(String name);

    @Select("select id,password from user where username = ?")
    Map<String,Object> mapIdPasswordByName(String name);

    @Insert("insert into user(username,password) values (?,?)")
    int insert(String name,String password);

    @Delete("delete from user where id = ?")
    Integer delete(Integer id);

    @Select("select id,username from user where id = ?")
    Login login(Integer id);
}
